{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[5, 13, 25, 18, 7, 15, 25]\n"
     ]
    }
   ],
   "source": [
    "# 有一个列表lst = [1, 4, 9, 16, 2, 5, 10, 15]，生成一个新列表，要求新列表元素是lst相邻2项的和\n",
    "\n",
    "lst = [1, 4, 9, 16, 2, 5, 10, 15]\n",
    "nlst = []\n",
    "for i in range(len(lst) - 1):\n",
    "    nlst.append( lst[i] + lst[ i+1 ])\n",
    "\n",
    "print(NewLst)\n",
    "\n",
    "# 完成的不错"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
